$(function(){
  $("#farticulo").autocomplete({
    source: base_url+'panel/infografia/ajax_get_articulos',
    minLength: 1,
    selectFirst: true,
    select: function( event, ui ) {
      $("#fid").val(ui.item.id);
    }
  });

  $("#farticulo").on("keydown", function(event) {
    if(event.which === 8 || event === 46) {
      $("#fid").val('');
      $(this).val('');
    }
  });
});